using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Content;

namespace TimeWar
{
    public class Tardis: VectorShape
    {

        protected Game gameObj = null;

        public Tardis(Game game)
            : base(game, ShapeTypes.Starship)
        {
            // TODO: Construct any child components here
            gameObj = game;
            ModelLocation = "Content\\Models\\TARDIS";
            Scale = 50;
            Initialize();
        }


        public Tardis(Game game, String modelLocn)
            : base(game, ShapeTypes.Starship)
        {
            // TODO: Construct any child components here
            gameObj = game;
            ModelLocation = modelLocn;
            Scale = 50;
            Initialize();
        }

        public override void Render()
        {
            Draw();
            //base.Render();
        }


        public override void Update(TimeSpan time, TimeSpan elapsedTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                gameObj.Exit();
            }

            //modelRotation += (float)elapsedTime.TotalMilliseconds * MathHelper.ToRadians(0.1f);
            //modelRotation = 270;
            if (GamePad.GetState(PlayerIndex.One).DPad.Left == ButtonState.Pressed)
            {
                RollLeft(1);
                
            }
            else if (GamePad.GetState(PlayerIndex.One).DPad.Right == ButtonState.Pressed)
            {
                RollRight(1);
            }
            else if (GamePad.GetState(PlayerIndex.One).DPad.Up == ButtonState.Pressed)
            {
                PitchDown(1);
            }
            else if (GamePad.GetState(PlayerIndex.One).DPad.Down == ButtonState.Pressed)
            {
                PitchUp(1);
            }

            if (GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.Y < 0)
            {
                MoveForwards(1);
            }
            else if (GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.Y > 0)
            {
                MoveBackwards(1);
            }

            if (GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.X < 0)
            {
                StrafeLeft(1);
            }
            else if (GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.X > 0)
            {
                StrafeRight(1);
            }
            


        }

        protected override void FillBuffer(VertexPositionColor[] data)
        {
            return;
        }

        protected override int NumberOfVectors
        {
            get { return 1; }
        }

        public override void onCollision()
        {
            throw new Exception("The method or operation is not implemented.");
        }


    }
}
